package ch02;

/**
 * @author chenmin
 * @desc TODO
 * @date 2025/9/2
 */
import java.util.Scanner;
public class For1 {
    public static void main(String[] args) {
        int num = (int) (Math.random() * 100) + 1;
        Scanner in = new Scanner(System.in);
        int count = 0;
        for (; count < 7; count++) {
            System.out.print("请输入1 - 100之间的数字：");
            int n = in.nextInt();
            if (n < num) {
                System.out.println("太小了，再大一点！");
            } else if (n > num) {
                System.out.println("太大了，再小一点！");
            } else {
                System.out.println("恭喜你猜对了！");
                break;
            }
        }
        if (count == 7) {
            System.out.println("你太笨了，下次再来吧！");
        }
        in.close();
    }
}